package com.itheima.service.impl;

import com.itheima.aop.Advice;
import com.itheima.bean.Student;
import com.itheima.service.StudentService;

import java.io.IOException;
import java.util.List;


public class StudentServiceImpl implements StudentService {
    @Override
    public List<Student> findAll() throws IOException {
        System.out.println("查询所有学生信息findAll...");
        return null;
    }
    @Override
    public Student findById(Integer id) throws IOException {
        System.out.println("根据id查询学生信息findById...");
        return new Student(1,"胡继周",42);
    }
    @Override
    public void insert(Student stu) throws IOException {
        //执行添加操作
        System.out.println("添加学生信息insert...");
    }
    @Override
    public void update(Student stu) throws IOException {
        System.out.println("修改学生信息update...");
    }
    @Override
    public void delete(Integer id) throws IOException {
        System.out.println("根据id删除学生信息delete...");
    }

    /**
     *  需求：张三向李四转1000块钱
     * @param outId 转出账户的id
     * @param inId 转入账户的id
     * @param money 转的钱
     */
    public void transfer(Integer outId,Integer inId,double money){
        //1 张三的账户-1000元
        System.out.println("调用dao：张三("+outId+")的账户"+(-money)+"元");
        int i=10/0;
        //2 李四的账户+1000元
        System.out.println("调用dao：李四("+inId+")的账户"+money+"元");
    }

}
